//
//  JMTechnicTableViewController.m
//  仿生物无忧
//
//  Created by JimmyPeng on 15/12/7.
//  Copyright © 2015年 彭继宗. All rights reserved.
//

#import "JMTechnicTableViewController.h"


#import "JMNewsCell.h"

@interface JMTechnicTableViewController ()

@property (nonatomic, strong) NSArray *newsArr;

@end

@implementation JMTechnicTableViewController



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    JMNewsCell *cell = [tableView dequeueReusableCellWithIdentifier:@"JMNewsCell" forIndexPath:indexPath];
    
    if (self.newsArr.count != 0)
    {
        
        JMListNews *list = self.newsArr[indexPath.row];
        
        cell.list = list;
    }
    
    
    return cell;
}

#pragma mark- 发送网络请求
//发送网络请求
- (void)sendNetwork
{
    //发送get请求
    [[JMNetworkTools shareNetworkTools] GET:@"http://www.swwy.com/app/android/newsApi.php?authKey=0ac02eaf32cc78a7e10abe4d40bf25ec&cid=47&device=4&page=1&pageSize=10" parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject){
        //下载放到自己数组中
        self.newsArr = [JMListNews listVideos:responseObject[@"data"][@"list"] ];
        //刷新tableView
        [self.tableView reloadData];
        
    } failure:nil];
}

@end
